package com.ruoyi.web.controller.business;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.domain.dto.GxtNoticeQueryDto;
import com.ruoyi.web.domain.vo.GxtNoticeVo;
import com.ruoyi.web.service.impl.GxtNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * description:
 * auth fcb
 * date 2025-11-03 10:09
 **/
@RestController
@RequestMapping("/gxt/notice")
@Slf4j
@Api(tags = "公告管理")
public class GxtNoticeController extends BaseController {

    @Autowired
    private GxtNoticeService gxtNoticeService;

    @GetMapping("/jsoup")
    @ApiOperation("爬取通知数据")
    public AjaxResult  jsoup(@RequestParam("type")String type, @RequestParam("pageNum")String pageNum) {
        gxtNoticeService.getGxtNotice(type, pageNum);
        return AjaxResult.success();
    }

    @GetMapping("/queryList")
    @ApiOperation("查询列表")
    public TableDataInfo queryList(GxtNoticeQueryDto queryDto) {
        startPage();
        List<GxtNoticeVo> list = gxtNoticeService.queryGxtNoticeList(queryDto);
        return getDataTable(list);
    }

    @GetMapping("/queryById")
    @ApiOperation("查询详情")
    public AjaxResult queryById(@RequestParam("baseId")String baseId) {
        return AjaxResult.success(gxtNoticeService.queryGxtNoticeById(baseId));
    }
}
